#!/bin/sh

# Converts the last NEWS entry to GitHub format

sed -n -e '
n
:next

# stop at the second header
/^[A-Za-z0-9_-]/q
# strip the leading indentation
s/^    //
# Make titles
s/^[A-Za-z0-9_-]/## \0/
# Turn PR and Issue references to links
s%PR#\([0-9]\{1,\}\)%[\0](https://github.com/geany/geany/pull/\1)%g
s%Issue#\([0-9]\{1,\}\)%[\0](https://github.com/geany/geany/issues/\1)%g

p
n
b next
' < NEWS
